package com.gitee.wsl.common.svg.attributes

interface HasTransform {
   var transform:String?

   fun translate(x:Float,y:Float=0f)

   fun scale(x:Float,y:Float=x)

   fun rotate(arg:Int,x:Float,y:Float)

   fun skewX(arg:Int)

   fun skewY(arg: Int)
}

class HasTransformImp(hasAttributes: HasAttributes) : HasTransform, HasAttributes by hasAttributes {
   override var transform: String? by AttributeProperty()

   override fun translate(x: Float, y: Float) {
      val str=" translate($x, $y) "
      transform = (transform?:"")+str
   }

   override fun scale(x: Float, y: Float) {
      val str=" scale($x, $y) "
      transform = (transform?:"")+str
   }

   override fun rotate(arg: Int, x: Float, y: Float) {
      val str=" rotate($arg,$x, $y) "
      transform = (transform?:"")+str
   }

   override fun skewX(arg: Int) {
      val str=" skewX($arg) "
      transform = (transform?:"")+str
   }

   override fun skewY(arg: Int) {
      val str= " skewY($arg) "
      transform = (transform?:"")+str
   }

}